#include<iostream>
#include<unistd.h>
int main()
{
    char buffer[1024];
    while (true)
    {
        ssize_t s= ::read(0,buffer,sizeof(buffer)-1);
        if(s>0)
        {
            buffer[s] = 0;
            std::cout<<"Echo# "<<buffer<<std::endl;
        }
        else
        {
            //底层条件就绪和读取错误采用的同样返回之操作
            if(errno == EWOULDBLOCK||errno==EAGAIN)
            {
                std::cout<<"底层没有数据就"<<std::endl;
                sleep(1);
                continue;
            }
            else if(errno==EINTR)
            {
                continue;
            }
            else
            {
                std::cout<<"读取错误"<<s<<std::endl;
                sleep(1);
            }
        }
    }
    
}